<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>通过选择器查找节点</title>
</head>
<body>
    <p class="p1">p1</p>
    <p class="p1">p2</p>
    <div id="i1">
        <p>
            p3
        </p>
        <div class="p1"> xxx</div>
    </div>    
</body>
<script>
    function queryAllC1(){
     let doms=document.querySelectorAll(".p1");
     console.log("c1元素的个数:",doms.length);

    }
    function queryC1(){
        let dom=document.querySelector("#i1>.p1");
        console.log("div下的c1的内容",dom.innerText);
    }
    queryAllC1();
    queryC1();

</script>
</html>